<template>
  <div class="approval">
    <el-card class="box-card" style="margin-bottom: 10px;">
      <div class="title">{{$t('approvalDetail.locateInfo')}}</div>
      <div class="location-content">
        <el-col :span="10">
          <div id="location-map">
            <div>
              {{$t('approvalDetail.mapsWarning')}}
            </div>
          </div>
        </el-col>
        <el-col :span="14">
          <div class="location-info">
            <div class="detail-info">
              <div class="detail-info-item">
                <span>{{$t('approvalDetail.regGps')}}:</span>
                <span>{{addressObj.registerAddress}}</span>
              </div>
              <div class="detail-info-item">
                <span>{{$t('approvalDetail.liveAddress')}}:</span>
                <span>{{addressObj.dwellAddress}}</span>
              </div>
              <div class="detail-info-item">
                <span>{{$t('approvalDetail.companyAddress')}}:</span>
                <span>{{addressObj.companyAddress}}</span>
              </div>
            </div>
            <div class="location-table">
              <div class="location-thead">
                <div>{{$t('approvalDetail.longitude')}}</div>
                <div>{{$t('approvalDetail.latitude')}}</div>
                <div>{{$t('approvalDetail.address')}}</div>
                <div style="border-right: 0;">{{$t('approvalDetail.smsCrtTime')}}</div>
              </div>
              <div class="location-tbody">
                <div style="border-bottom: 0;">{{addressObj.longitude}}</div>
                <div style="border-bottom: 0;">{{addressObj.latitude}}</div>
                <div style="border-bottom: 0;">{{addressObj.currAddress}}</div>
                <div style="border-right: 0; border-bottom: 0;">{{addressObj.crtTime}}</div>
              </div>
            </div>
          </div>
        </el-col>
      </div>
    </el-card>
  </div>
</template>

<script>
// import google from 'google';
import { mapGetters } from "vuex";
import { getLoanLonglatitudePage } from "api/trust/firstApprDetails/index";
export default {
  data() {
    return {
      listObj: {},
      addressObj: {}
    };
  },
  computed: {
    ...mapGetters(["elements", "language", "firstApprDetails"])
  },
  created() {
    this.getParamsDetail();
    this.getLocateInfo();
  },
  mounted() {
    // this.initMaps();
  },
  methods: {
    getParamsDetail() {
      this.listObj = this.firstApprDetails;
    },
    // 定位信息
    getLocateInfo() {
      let locateInfoObj = {};
      locateInfoObj.orderId = this.listObj.orderId;
      locateInfoObj.userId = this.listObj.userId;
      locateInfoObj.userUUID = this.listObj.addressBookUuid;
      getLoanLonglatitudePage(locateInfoObj).then(res => {
        if (res.status === 200) {
          this.addressObj = res.data;
        }
      });
    }
  }
};
</script>

<style scoped lang='scss'>
.title {
  line-height: 22px;
  font-size: 16px;
  display: flex;
  align-items: center;
  font-weight: bold;
  font-weight: bold;
}
.title:before {
  display: block;
  content: "";
  width: 3px;
  height: 16px;
  background-color: #309afe;
}
.title:before {
  margin-right: 8px;
}
::before {
  box-sizing: inherit;
  -webkit-tap-highlight-color: transparent;
}
.menu-title {
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  .searchItem {
    display: flex;
    align-items: center;
    padding: 10px 0;
    span {
      display: inline-block;
      width: 100px;
      text-align: right;
      font-size: 12px;
      color: #5f5f61;
      padding-right: 5px;
    }
    div:nth-child(2) {
      width: 150px;
    }
  }
  .searchItem-date {
    display: flex;
    align-items: center;
    padding: 10px 0;
    b {
      margin: 0 10px;
      font-weight: normal;
      font-size: 12px;
      color: #5f5f61;
    }
    div {
      width: 150px;
    }
  }
}
.menu-title-btn {
  padding: 10px 0;
  box-sizing: border-box;
  button {
    padding: 0 20px;
    height: 28px;
    background: #20a0ff;
    color: #fff;
    outline: none;
    border-width: 0;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
    &:nth-child(1) {
      margin-left: 0;
    }
    &:nth-child(2) {
      background: #ebf5ff;
      color: #20a0ff;
      border: 1px solid #abd5ff;
    }
  }
}
.menu-list {
  padding: 20px 0;
  box-sizing: border-box;
  .left {
    button {
      padding: 0 20px;
      height: 28px;
      background: #20a0ff;
      color: #fff;
      outline: none;
      border-width: 0;
      border-radius: 4px;
      font-size: 12px;
      margin-left: 10px;
      &:nth-child(1) {
        margin-left: 0;
      }
    }
    button[disabled] {
      padding: 0 20px;
      height: 28px;
      background: #c1e0ff;
      color: #fafbff;
      outline: none;
      border-width: 0;
      border-radius: 4px;
      font-size: 12px;
    }
  }
}
.el-date-editor.el-input {
  width: 193px;
}
.menu-list {
  width: 100%;
  display: flex;
  justify-content: space-between;
}
.statistics {
  div {
    margin-right: 40px;
    font-size: 16px;
  }
}
#location-map {
  width: 100%;
  height: 290px;
  border: 1px solid #dfe6ec;
  margin-right: 5px;
  margin-left: 12px;
  position: relative;
  &>div {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}
.location-info {
  margin-left: 30px;
  .detail-info {
    font-size: 12px;
    .detail-info-item {
      line-height: 25px;
      span:nth-child(1) {
        display: inline-block;
        width: 130px;
        text-align: left;
        margin-right: 5px;
        color: #616264;
      }
      span:nth-child(2) {
        color: #8a8a8c;
      }
    }
  }
}
.location-content {
  display: flex;
  margin-top: 10px;
}
.location-table {
  width: 100%;
  border: 1px solid #dfe6ec;
  font-size: 12px;
  margin-top: 20px;
  .location-thead{
    display: flex;
    flex-wrap: wrap;
    font-weight: bold;
    div {
      text-align: center;
      width: 25%;
      padding: 15px;
      box-sizing: border-box;
      border-right: 1px solid #dfe6ec;
      border-bottom: 1px solid #dfe6ec;
    }
  }
  .location-tbody {
    display: flex;
    flex-wrap: wrap;
    div {
      text-align: left;
      width: 25%;
      padding: 15px;
      box-sizing: border-box;
      border-right: 1px solid #dfe6ec;
      border-bottom: 1px solid #dfe6ec;
      word-wrap: break-word;
      word-break: break-all;
      overflow: hidden;
    }
  }
}
</style>